﻿using HMS.Core;
using HMS.Core.Abstractions;
using HMS.MultiTenant.SqlServer;
using Microsoft.Extensions.DependencyInjection;

namespace Microsoft.EntityFrameworkCore;

public static class MultiTenantDesignTimeExtensions
{
    public static IServiceCollection AddSqlServerMultiTenant(this IServiceCollection services)
    {
        services.AddDbContext<DesignTimeDbContext>(options
            => options
                .UseSqlServer());

        services.AddModelRuntimeInitializer();
        services.AddSingleton<IModelBuilderProvider, SqlServerModelBuilderProvider>();

        return services;
    }
}